refactor: extract experimental target loader wrapper#295
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Important Review skippedAuto reviews are limited based on label configuration. 🚫 Review skipped — only excluded labels are configured. (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
loadExperimentalSyncTargetwrapper out ofsettings-hubon top of the latest settings leafValidation
npm run typechecknpm run lint -- lib/codex-manager/experimental-sync-target-entry.ts lib/codex-manager/settings-hub.ts test/experimental-sync-target-entry.test.tsnpm run test -- test/experimental-sync-target-entry.test.tsnote: greptile review for oc-chatgpt-multi-auth. cite files like
lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.Greptile Summary
clean extraction of the
loadExperimentalSyncTargetEntrywrapper out ofsettings-hub.ts— thereadJsonadapter (wiringreadFileWithRetrywith windows-safe retry codes into a json-parse helper) is now a standalone injectable unit. behavior is a faithful 1:1 move with no logic changes.experimental-sync-target-entry.ts— new module; assemblesreadJsonfromreadFileWithRetry+{EBUSY, EPERM, EAGAIN, ENOTEMPTY, EACCES}retry set andmaxAttempts: 4, then delegates toloadExperimentalSyncTargetStatesettings-hub.ts— call-site slimmed to a simpleloadExperimentalSyncTargetEntry(...)pass-through; all injected deps (readFileWithRetry,sleep,normalizeAccountStorage) are forwarded correctlyexperimental-sync-target-entry.test.ts— single delegation test added, butreadFileWithRetryis never actually invoked becauseloadExperimentalSyncTargetStateis fully mocked; the windows retry-code assembly is the key extracted behavior and it lacks a covering testConfidence Score: 4/5
Important Files Changed
readJsonfromreadFileWithRetry+ windows retry codes and delegates toloadExperimentalSyncTargetState; behavior is a faithful 1:1 extraction from settings-hubloadExperimentalSyncTargetEntry; all five retry codes and sleep injection are correctly forwarded, no behavior changereadJsonclosure, leaving the windows-safe retry code assembly untestedSequence Diagram
sequenceDiagram participant SH as settings-hub.ts participant ESTE as experimental-sync-target-entry.ts participant EST as experimental-sync-target.ts participant RFR as readFileWithRetry SH->>ESTE: loadExperimentalSyncTargetEntry({ loadExperimentalSyncTargetState, detectTarget, readFileWithRetry, normalizeAccountStorage, sleep }) note over ESTE: builds readJson closure<br/>retryableCodes: EBUSY/EPERM/EAGAIN/ENOTEMPTY/EACCES<br/>maxAttempts: 4 ESTE->>EST: loadExperimentalSyncTargetState({ detectTarget, readJson, normalizeAccountStorage }) EST->>RFR: readJson(path) → readFileWithRetry(path, retryOptions) RFR-->>EST: file contents string EST-->>ESTE: { kind, detection, destination? } ESTE-->>SH: { kind, detection, destination? }Prompt To Fix All With AI
Last reviewed commit: "refactor: extract ex..."